package com.qms.repast.ui.presenter;

import android.app.Activity;

import com.orhanobut.logger.Logger;
import com.qms.repast.commons.Constants;
import com.qms.repast.entity.reqbean.ReqRemark;
import com.qms.repast.entity.resbean.RemarkBean;
import com.qms.repast.module.UserModule;
import com.qms.repast.ui.base.BasePresenter;
import com.qms.repast.ui.view.IOrderRemarkView;

import io.reactivex.observers.DisposableObserver;

/**
 * @author 泅渡者
 * @date 2018/10/23 0023
 * @describe: 点餐备注
 */
public class OrderRemarkPresenter extends BasePresenter<IOrderRemarkView> {

	private UserModule userModule;

	public OrderRemarkPresenter (Activity mContext, IOrderRemarkView mView) {
		super(mContext, mView);
		this.userModule = new UserModule(mContext);
	}


	public void getRemarkList (ReqRemark reqRemark) {
		userModule.reqRemark(reqRemark,new DisposableObserver<RemarkBean>() {
			@Override
			public void onError (Throwable throwable) {
				Logger.e(throwable.getMessage());
			}

			@Override
			public void onComplete () {
				Logger.d("Request is End");
			}

			@Override
			public void onNext (RemarkBean remarkBean) {
				if (Constants.SUCCESS == remarkBean.getCode()) {
					mView.updateLables(remarkBean.getBody());
				}
			}
		});
	}
}
